package top.hkyzf.study.leetcode.array;

import org.junit.Test;

import java.util.Arrays;
import java.util.Collections;

/**
 * description: 
 * @author zhufeng
 * @date 2024/2/2 0002 11:39
 * @version V1.0
 */
public class 石子游戏VI_1686 {
    public int stoneGameVI(int[] aliceValues, int[] bobValues) {
        Integer[] resValues = new Integer[aliceValues.length];
        int aliceCount = 0;
        int bobCount = 0;
        for (int i = 0; i < resValues.length; i++) {
            resValues[i] = aliceValues[i] + bobValues[i];
        }
        Arrays.sort(resValues, Collections.reverseOrder());
        System.out.println(Arrays.toString(resValues));
        for (int i = 0; i < resValues.length; i++) {
            if (i % 2 == 0) {
                aliceCount += resValues[i];
            } else {
                bobCount += resValues[i];
            }
        }
        return Integer.compare(aliceCount, bobCount);
    }

    @Test
    public void testStoneGame () {
        int[] aliceValues = {1,2};
        int[] bobValues = {3,1};
        System.out.println(stoneGameVI(aliceValues, bobValues));
    }
}
